import request from './request'

export default {
  // ---- 首页 ----

  // 获取公告
  getNotice: (params) =>
    request.get('/shop/addons/shop/api.common/base', params),

  // 获取轮播图列表
  getSwiperList: (params) =>
    request.get('/shop/addons/shop/api.swiper/index', params),

  // 获取热门产品列表
  getHotProductList: (params) =>
    request.get('/shop/addons/shop/api.goods/index', params),

  // 获取产品列表
  getProductList: (params) =>
    request.get('/shop/addons/shop/api.goods/lists', params),

  // 获取产品详情
  getProductDetail: (params) =>
    request.get('/shop/addons/shop/api.goods/detail', params),

  // ---- 分类 ----

  // 获取分类列表
  getClassifyList: (params) =>
    request.get('/shop/addons/shop/api.category/index', params),

  // ---- 购物车 ----

  // 获取购物车列表
  getShopcarList: (params) =>
    request.get('/shop/addons/shop/api.cart/index', params),

  // 添加购物车
  addShopcar: (params) =>
    request.post('/shop/addons/shop/api.cart/add', params),

  // 删除购物车
  delShopcar: (params) =>
    request.post('/shop/addons/shop/api.cart/del', params),

  // 结算购物车
  confirmShopcar: (params) =>
    request.post('/shop/addons/shop/api.order/carts', params),

  // 修改购物车数量
  setShopcarNum: (params) =>
    request.post('/shop/addons/shop/api.cart/set_nums', params),

  // ---- 生态 ----

  // 获取生态列表
  getEcologyList: (params) =>
    request.get('/shop/addons/shop/api.friendly/index', params),

  // ---- 我的 ----

  // 登录
  login: (params) => request.post('/shop/api/user/direct', params),

  // 获取订单列表
  getOrderList: (params) =>
    request.get('/shop/addons/shop/api.order/index', params),

  // 删除订单
  delOrder: (params) =>
    request.post('/shop/addons/shop/api.order/cancel', params),

  // 确认收货
  takeProduct: (params) =>
    request.post('/shop/addons/shop/api.order/complete', params),

  // 查看物流
  checkLogistics: (params) =>
    request.post('/shop/addons/shop/api.order/logistics', params),

  // 获取订单详情
  getOrderDetail: (params) =>
    request.get('/shop/addons/shop/api.order/detail', params),

  // 获取收货地址列表
  getAddressList: (params) =>
    request.get('/shop/addons/shop/api.address/index', params),

  // 新增、编辑收货地址
  postAddress: (params) =>
    request.post('/shop/addons/shop/api.address/addedit', params),

  // 删除收货地址
  delAddress: (params) =>
    request.post('/shop/addons/shop/api.address/del', params),

  // 获取默认收货地址
  getDefaultAddress: (params) =>
    request.get('/shop/addons/shop/api.address/def_address', params),
}
